<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>GitHub Issue 1367</title>
    <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
    <script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.js"></script>
    <script src="../../../dist/jsoneditor.js"></script>
  </head>
  <body>
    <div class="container">
      <a href="https://github.com/json-editor/json-editor/issues/1158">GitHub Issue 1367</a>
      <label for="value">Value</label>
      <textarea class="form-control" id="value" rows="6" style="font-size: 12px; font-family: monospace;"></textarea>
      <div id='editor_holder'></div>
    </div>

    <script>
      var defaultSchema = {
        'type': 'object',
        'title': 'Document',
        'properties': {
          'signature': {
            'type': 'string',
            'format': 'signature',
            'title': 'Signature',
            'options': {
              'canvas_height': 500
            }
          }
        }
      }

      var value = document.querySelector('#value')
      var editor = new JSONEditor(document.getElementById('editor_holder'),{
        iconlib: 'fontawesome5',
        object_layout: 'normal',
        schema: defaultSchema,
        show_errors: 'always',
        theme: 'bootstrap4'
      });

      editor.on('change', function () {
        value.value = JSON.stringify(editor.getValue())
      })
    </script>
  </body>
</html>
